<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>WebSocket客户端</title>
</head>
<body>

<script>
    let ws = new WebSocket("ws://localhost:8080/ws/" + new Date().getTime())
    ws.onopen = function () {
        console.log("连接成功")
        ws.send("你好，服务器")
    }

    ws.onmessage = function (message) {
        console.log("收到消息：" + message.data)
    }

    ws.onclose = function () {
        console.log("连接关闭")
    }
</script>
</body>
</html>